package top.ninwoo.utils.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.ninwoo.utils.service.NetworkMonitorService;
import top.ninwoo.utils.util.DockerUtils;

/**
 * @Author joliu
 * @Description
 * @Date　Create in 上午10:07 2019/11/4
 */
@Service
public class NetworkMonitorServiceImpl implements NetworkMonitorService {
    @Autowired
    DockerUtils dockerUtils;

    public double testLoss(String containerId, String targetIp) {
        String cmd = "mtr -r -c 30 -s 1024 " + targetIp;
        String result = dockerUtils.execInDocker(containerId, targetIp);

        // parse result
        System.out.println(result);
        return 0.0;
    }

}
